package cc.vicp.djx314.starfood.service.order;

import java.util.List;

import cc.vicp.djx314.starfood.domain.account.Personnel;
import cc.vicp.djx314.starfood.domain.account.User;
import cc.vicp.djx314.starfood.domain.order.Order;
import cc.vicp.djx314.starfood.domain.order.OrderDish;
import cc.vicp.djx314.starfood.service.exception.DishNotFoundException;
import cc.vicp.djx314.starfood.service.exception.NoOrderDishesException;
import cc.vicp.djx314.starfood.service.exception.OrderNotFoundException;

public interface OrderService {

	public static final Integer FINAL_STATUS = 3;

	/**
	 * 下一个订单
	 * @param order
	 * @return
	 * @throws NoOrderDishesException 
	 */
	public boolean createOrder(Order order) throws NoOrderDishesException;

	public List<OrderDish> getMoreOrderDishesInfo(List<OrderDish> orderDishes) throws DishNotFoundException;

	public Order getOrderForPersonnel(Integer orderId) throws OrderNotFoundException;

	public Order getCurrentOrderForPersonnel() throws OrderNotFoundException;

	/**
	 * 作废订单
	 * @param orderId 要作废订单的id
	 * @return
	 */
	public void updateOrderCancled(Integer orderId);

	/**
	 * 确认订单
	 * @param order
	 * @return
	 */
	public void updateOrderEnabled(Order order);

	/**
	 * 获取订单作流程控制之用
	 * @param orderId
	 * @return
	 */
	public Order getOrderForFlowById(Integer orderId);

	/**
	 * 更新订单流程
	 * @param orderId
	 * @param status
	 * @throws Exception
	 */
	public void updateOrderFlowStatus(Integer orderId, Integer status) throws Exception;

	/**
	 * 抽回订单
	 * @param orderId
	 * @throws Exception
	 */
	public void updateOrderFlowDraw(Integer orderId) throws Exception;

	/**
	 * 根据id获取一张已经取消了的订单
	 * @param orderId
	 * @return
	 */
	public Order getOrderCancledById(Integer orderId);

	/**
	 * 恢复作废的订单
	 * @param orderId
	 * @return
	 * @throws Exception 
	 */
	public void updateOrderUncanceled(Integer orderId) throws Exception;

	/**
	 * 获取今天作废的订单
	 * @return
	 */
	public List<Order> getCanceledOrderToday();

	public void updateOrderFlowStatusFinish(Integer orderId, Integer status, Personnel personnel) throws Exception;

	public List<Order> getOrdersInfoForUser(User user);
}